package com.extendy.onlyofficerapiddeployment.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    /**
     * 配置静态资源映射
     * 将文件映射到file文件夹下
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String resourcesPath = System.getProperty("user.dir") + "/src/main/resources/file/";
        registry
                .addResourceHandler("/file/**")
                .addResourceLocations("file:" + resourcesPath);
    }
}
